<div class="form_title">Search Credit Memo</div>
  <?php echo form_tag('creditMemo/doSearch',array('id'=>'creditMemoSearchForm',))?>
    <?php echo $creditMemoSearchForm['_csrf_token']?>
    <table class="form">
      <tr>
        <th class="field">Credit Memo#</th>
        <td class="field">
          <?php echo $creditMemoSearchForm['credit_type']?>
          <?php echo $creditMemoSearchForm['credit_number_from']?> - 
          <?php echo $creditMemoSearchForm['credit_number_to']?>
        </td>
      </tr>
      <tr>
        <th class="field">Credit Date</th>
        <td class="field">
          <?php echo $creditMemoSearchForm['credit_date_from']?> - 
          <?php echo $creditMemoSearchForm['credit_date_to']?>
        </td>
      </tr>
      <tr>
        <th class="field">Invoice#</th>
        <td class="field">
          <?php echo $creditMemoSearchForm['invoice_type']?>
          <?php echo $creditMemoSearchForm['invoice_number_from']?> - 
          <?php echo $creditMemoSearchForm['invoice_number_to']?>
        </td>
      </tr>
      <tr>
        <th class="field">Name</th>
        <td class="field"><?php echo $creditMemoSearchForm['customer_name']?>
          <div id="creditMemoShowVoidOnly">
          <?php echo $creditMemoSearchForm['show_void_only']->renderLabel()?>
          <?php echo $creditMemoSearchForm['show_void_only']?>
          </div>
        </td>
      </tr>
    </table>
    <center>
      <input type="submit" value="Search"/> | 
      <input type="reset" value="Reset"/>
    </center>
  </form>
<br/>  
<div id="creditMemoSearchGrid">
</div>
<a href="#" id="creditMemoShowGrid" style="display:none">Show Search Results</a>

<div id="creditMemoPanel" style="display:none;">
</div>


<script language="javascript">
  $(document).ready(
    function(){
      $('#creditMemoSearchForm').submit(
        function(){
          showStatusWindow();
          $(this).ajaxSubmit(
            {
              type: 'post',
              dataType: 'html',
              success: 
              function(data,statusText){
                $('#creditMemoSearchGrid').html(data);
                $('#creditMemoSearchGrid').show();
                $('#creditMemoPanel').hide();
                $('#creditMemoFormDiv').remove();
                $('#creditMemoShowGrid').hide();
                hideStatusWindow();
              },
            }
          );
          return false;
        }
      );
      $('#creditMemoShowGrid').click(
        function(e){
          $(this).hide();
          $('#creditMemoSearchGrid').show();
          $('#creditMemoPanel').hide();
          $('#creditMemoFormDiv').remove();
          e.preventDefault();
        }
      );
    }
  );
</script>
